#define _CRT_SECURE_NO_WARNINGS 1

void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n) 
{
    int destination[6];
    int dest = 0;
    int sour1 = 0;
    int sour2 = 0;
    while (sour1 < m || sour2 < n)
    {
        if(nums1[sour1]==0)
        {
            sour1++;
        }
        else if (nums2[sour2] == 0)
        {
            sour2++;
        }
        else if (nums1[sour1] > nums2[sour2])
        {
            destination[dest++] = nums2[sour2++];
        }
        else
        {
            destination[dest++] = nums1[sour1++];
        }
    }

    dest = 0;
    sour1 = 0;
    while (dest < m + n)
    {
        nums1[sour1++] = destination[dest++];
    }

}

int main()
{
    int nums1[6] = { 1,2,3,0,0,0 };
    int nums2[3] = { 2,5,6 };
    int m = 3;
    int n = 3;
    int nums1Size = 6;
    int nums2Size = 3;
    merge(nums1, 6, 3, nums2, 3, 3);
    return 0;
}